package com.zzc.zzcapi.service.impl.inner;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zzc.keleapiCommon.model.dto.UserDTO;
import com.zzc.keleapiCommon.service.InnerUserService;

import com.zzc.zzcapi.model.entity.User;
import com.zzc.zzcapi.service.UserService;

import org.apache.dubbo.config.annotation.DubboService;

import javax.annotation.Resource;

@DubboService
public class InnerUserServiceImpl implements InnerUserService {
    @Resource
    UserService userService;
    @Override
    public UserDTO getInvokeUser(String accessKey) {
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("accessKey", accessKey);
        User user = userService.getOne(queryWrapper);
        UserDTO userDTO = new UserDTO();
        userDTO.setSecretKey(user.getSecretKey());
        userDTO.setId(user.getId());
        return userDTO;
    }
}
